package cn.sytton.taffecloud.common.servlet.log.mapper;

import cn.sytton.taffecloud.common.db.mapper.LogSqlMapper;
import cn.sytton.taffecloud.common.model.log.ApiLogEntity;
import org.apache.ibatis.annotations.Insert;

/**
 * Api访问日志Mapper
 *
 * @author skyrock
 */
public interface RequestLogMapper extends LogSqlMapper {

    /**
     * 生成日志
     * @param entity 日志实体
     * @return 返回
     */
    @Insert("insert into sys_api_log(\n" +
            "            userId,\n" +
            "            loginName,\n" +
            "            userCode,\n" +
            "            userName,\n" +
            "            accessSource,\n" +
            "            requestMethod,\n" +
            "            url,\n" +
            "            method,\n" +
            "            methodName,\n" +
            "            params,\n" +
            "            success,\n" +
            "            result,\n" +
            "            errMsg,\n" +
            "            ip,\n" +
            "            location,\n" +
            "            os,\n" +
            "            browser,\n" +
            "            beginTime,\n" +
            "            endTime\n" +
            "        ) values (\n" +
            "            #{userId},\n" +
            "            #{loginName},\n" +
            "            #{userCode},\n" +
            "            #{userName},\n" +
            "            #{accessSource},\n" +
            "            #{requestMethod},\n" +
            "            #{url},\n" +
            "            #{method},\n" +
            "            #{methodName},\n" +
            "            #{params},\n" +
            "            #{success},\n" +
            "            #{result},\n" +
            "            #{errMsg},\n" +
            "            #{ip},\n" +
            "            #{location},\n" +
            "            #{os},\n" +
            "            #{browser},\n" +
            "            #{beginTime},\n" +
            "            #{endTime}\n" +
            "        )")
    int create(ApiLogEntity entity);
}
